package com.songtech.uitest.cases;

import com.songtech.uitest.components.IBrowserDriverFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.testng.annotations.*;

//此类用于测试类1~9的整体性的初始化和结尾操作
@ContextConfiguration(locations = {"classpath:spring-test-config.xml"})
public class TestBeforeAndAfter extends AbstractTestNGSpringContextTests {

    @Autowired
    @Qualifier("browserDriver")
    private IBrowserDriverFactory driverCreater;


    @BeforeSuite
    public void allBegin(){
    }

    //注意！！！！！！！！！！！！！！！
    //如果想要把@BeforeSuite，@AfterSuite，@BeforTest, @AfterTest集中写在一个类里，
    //并且要使用spring注入的话，以下这个@Test必不可少！否则spring注入不了！！！！
    @Test
    public void testEmpty(){

    }


    @AfterSuite
    public void allOver(){
        try {
            driverCreater.closeAllDriver();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


}
